package com.wang.interview.tests;


/**
 * @author: wang
 * @date: 2021/7/27 09:25
 * @description: 枚举和 switch 结合使用
 */
public class T1 {

    public static void main(String[] args) {
        int a = 2;
        A q = null;
        if (a<3){
            q = A.xiaoshi;
        }else {
            q = A.xiaowei;
        }
        switch (q){
            case xiaowei:
                System.out.println("1");
                break;
            case xiaoshi:
                System.out.println("2");
                break;

            default:System.out.println("null");
        }
    }

}
enum A{
    // 啊啊啊
    xiaowei("1","qqq")
    // bbb
    ,xiaoshi("2","xxx");
    private String id;
    private String desc;

    A(String id, String desc) {
        this.id = id;
        this.desc = desc;
    }

    public String getId() {
        return id;
    }

    public String getDesc() {
        return desc;
    }

}


